package goodbaby.dklt;

import android.content.SharedPreferences;

/**
 * Created by Jayden on 2016/4/25 17:12.
 *
 * @version V1.0
 * @Title: GbbPreferences
 * @Description: ${todo}
 */
public class GbbPreferences {
    private static final String KEY_BRACELETADDRESS = "braceletAddress";
    private static final String KEY_CHILDRENNAME = "childrenName";
    private static final String KEY_CLASSID = "classId";
    private static final String KEY_CLASSNAME = "className";
    private static final String KEY_HEADIMG = "headImg";
    private static final String KEY_IS_FIRST = "isFirst";
    private static final String KEY_KEEP_LOGIN = "keepLogin";
    private static final String KEY_NICKNAME = "nickName";
    private static final String KEY_SCHOOLNAME = "schoolName";
    private static final String KEY_SOBJECT = "sObject";
    private static final String KEY_USERID = "userId";
    private static final String KEY_USER_ACCOUNT = "account";
    private static final String KEY_USER_PWD = "password";

    public static String getBraceletAddress()
    {
        return getString("braceletAddress");
    }

    public static String getChildrenName()
    {
        return getString("childrenName");
    }

    public static String getClassId()
    {
        return getString("classId");
    }

    public static String getClassName()
    {
        return getString("className");
    }

    public static String getHeadImg()
    {
        return getString("headImg");
    }

    public static String getIsFirst()
    {
        return getString("isFirst");
    }

    public static String getKeepLogin()
    {
        return getString("keepLogin");
    }

    public static String getNickName()
    {
        return getString("nickName");
    }

    public static String getSObject()
    {
        return getString("sObject");
    }

    public static String getSchoolName()
    {
        return getString("schoolName");
    }

    static SharedPreferences getSharedPreferences()
    {
        return GbbCache.getContext().getSharedPreferences("Sample", 0);
    }

    private static String getString(String paramString)
    {
        return getSharedPreferences().getString(paramString, null);
    }

    public static String getUserAccount()
    {
        return getString("account");
    }

    public static String getUserId()
    {
        return getString("userId");
    }

    public static String getUserPwd()
    {
        return getString("password");
    }

    public static void saveBraceletAddress(String paramString)
    {
        saveString("braceletAddress", paramString);
    }

    public static void saveChildrenName(String paramString)
    {
        saveString("childrenName", paramString);
    }

    public static void saveClassId(String paramString)
    {
        saveString("classId", paramString);
    }

    public static void saveClassName(String paramString)
    {
        saveString("className", paramString);
    }

    public static void saveHeadImg(String paramString)
    {
        saveString("headImg", paramString);
    }

    public static void saveIsFirst(String paramString)
    {
        saveString("isFirst", paramString);
    }

    public static void saveKeepLogin(String paramString)
    {
        saveString("keepLogin", paramString);
    }

    public static void saveNickName(String paramString)
    {
        saveString("nickName", paramString);
    }

    public static void saveSObject(String paramString)
    {
        saveString("sObject", paramString);
    }

    public static void saveSchoolName(String paramString)
    {
        saveString("schoolName", paramString);
    }

    private static void saveString(String paramString1, String paramString2)
    {
        SharedPreferences.Editor localEditor = getSharedPreferences().edit();
        localEditor.putString(paramString1, paramString2);
        localEditor.commit();
    }

    public static void saveUserAccount(String paramString)
    {
        saveString("account", paramString);
    }

    public static void saveUserId(String paramString)
    {
        saveString("userId", paramString);
    }

    public static void saveUserPwd(String paramString)
    {
        saveString("password", paramString);
    }
}
